import { defineComponent, toRefs } from 'vue'

export default defineComponent({

  props: {
    msg: {
      type: String
    }
  },

  setup(props, context) {
    let { msg } = toRefs(props)

    const toParent = () => {
      context.emit('changeTitle', 1)
    }

    return () => (
      <>
        <div>{msg.value}</div>
        <button onClick={toParent}>传给父组件</button>
      </>
    )
  }
})
